#  初始化卡片数量，0到9每个各2021张
# （其中每次迭代计算出一对键值对）
card_counts = {str(i): 2021 for i in range(10)}  # 字典推导式

num = 1

while True:
    s = str(num)
    flag = True
    for i in s:
        if card_counts[i] == 0:
            flag = False
            break
        card_counts[i] -= 1
    if not flag:  # 如果无法拼出则结束循环
        break
    num += 1
print(num - 1)  # 打印最后一个可以拼出的数字

# 字符串遍历
s = "apple"
for i in s:
    print(i, end=" ")
print()

# 字典访问
dic = {'apple': 1, 'banana': 2, 'orange': 3}
print(dic["apple"])
